package com.zrwl.poscloud.core.restapi.file;


import com.zrwl.poscloud.commons.utils.ResultUtil;
import com.zrwl.poscloud.xo.service.AccessManageService;
import com.zrwl.poscloud.xo.service.FileInfoService;
import com.zrwl.poscloud.xo.service.SyncService;
import com.zrwl.poscloud.xo.vo.FileInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/fileCommand")
public class FileCommandApi {

    @Autowired
    FileInfoService fileInfoService;
    @Autowired
    AccessManageService accessManageService;
    @Autowired
    SyncService syncService;

    /***
     * 删除文件（数据库标记为已删除）
     */
    @RequestMapping("/deleteFile")
    public String deleteFile(FileInfoVO fileInfoVO) {
        fileInfoService.deleteFileInfo(fileInfoVO.getUid());
        return ResultUtil.successWithMessage(null);
    }

    /***
     * 恢复文件
     */
    @RequestMapping("/recover")
    public String recoverFile(FileInfoVO fileInfoVO) {
        fileInfoService.recoverFileInfo(fileInfoVO.getUid());
        return ResultUtil.successWithMessage(null);
    }
}
